package client;

import java.io.FileInputStream;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import javax.sql.rowset.CachedRowSet;

/**
 * Interface for class handling database connections and methods.
 *
 * @author Anton
 *
 */
public interface DatabaseHandler extends java.rmi.Remote
{
	/**
	 * Method used to create a empty table
	 *
	 * @param name the name of the table
	 * @throws RemoteException
	 */
	void createTable(String name) throws RemoteException;

	/**
	 * Method for adding a new column to a table
	 *
	 * @param tableName which table to be used
	 * @param columnName name of the new column
	 * @param dbType the data type of the column
	 * @throws RemoteException
	 */
	void createColumn(String tableName, String columnName, String dbType) throws RemoteException;

	/**
	 * Method for adding a BLOB
	 *
	 * @param table which table to be used;
	 * @param fis the BLOB
	 * @param filelength the length of the filestream
	 * @throws RemoteException
	 */
	void addBLOB(String table, FileInputStream fis, long filelength) throws RemoteException;

	/**
	 * Method for adding data to a table
	 *
	 * @param tableName which table to inserted the data in
	 * @param values a HashMap contain column name and corresponding value
	 * @throws RemoteException
	 */
	void addData(String tableName, HashMap<String, Object> values) throws RemoteException;

	/**
	 * Method for getting data from a table
	 *
	 * @param tableName which table to get from
	 * @param columnReq which column to do a match on
	 * @param query the requirement
	 * @return the ResultSet returned from database
	 * @throws RemoteException
	 */
	ArrayList<String> getData(String tableName, String columnReq, String query) throws RemoteException;

	/**
	 *
	 * @param str1
	 * @param str2
	 * @param str3
	 * @throws RemoteException
	 */
	void deleteData(String str1, String str2, String str3) throws RemoteException;

}
